﻿namespace Refract.Data
{
    using System.Collections.Generic;

    using MVVM;

    /// <summary>
    /// Interface for data services
    /// </summary>
    /// <typeparam name="TEntity">The type of the entity.</typeparam>
    /// <typeparam name="TListEntity">The type of the list entity.</typeparam>
    /// <typeparam name="TListModel">The type of the list model.</typeparam>
    public interface IDataService<TEntity, TListEntity, TListModel> : IReadOnlyDataService<TEntity, TListEntity, TListModel>
        where TEntity : class, new()
        where TListEntity : IEnumerable<TEntity>, new()
        where TListModel : Model<TListEntity>, new()
    {
        #region Methods

        /// <summary>
        /// Adds the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        void Add(TEntity entity);

        /// <summary>
        /// Cancels any changes in the context.
        /// </summary>
        void CancelChanges();

        /// <summary>
        /// Deletes the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        void Delete(TEntity entity);

        /// <summary>
        /// Saves any changes in the context.
        /// </summary>
        void Save();

        #endregion Methods
    }
}